

import nw from "nw-lafjs";
import {ok} from "@/utils/responseUtil";
import cloud from "@lafjs/cloud";

export default async function (ctx: FunctionContext) {
  let userId = ctx.user.admin
  let cartList = await nw.db.findListByWhereJson({
    dbName:"cartInfo",
    whereJson:{deleted:0,userId:userId,status:1,skuNum:cloud.database().command.gt(0)}
  })
  if (!nw.util.isNull(cartList)){
    for (let i = 0; i < cartList.length; i++) {
      cartList[i].id = cartList[i]._id
    }
  }
  return ok(cartList)
}
